home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_netpbm.idb / usr / freeware / catman / p_man / cat3 / libppm.Z / libppm
Encoding:
Text File  |  1998-10-28  |  6.6 KB  |  200 lines

  1. /xlv1/freeware/1998.Oct/netpbm/1mar1994/netpbm.diffbuild/ppm
  2.  
  3.  
  4.  
  5.      lllliiiibbbbppppppppmmmm((((3333))))               UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV             lllliiiibbbbppppppppmmmm((((3333))))
  6.  
  7.  
  8.  
  9.      NNNNAAAAMMMMEEEE
  10.       libppm - functions to    support    portable pixmap    programs
  11.  
  12.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.       #include <ppm.h>
  14.       cc ... libppm.a libpgm.a libpbm.a
  15.  
  16.  
  17.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  18.     TTTTYYYYPPPPEEEESSSS AAAANNNNDDDD CCCCOOOONNNNSSSSTTTTAAAANNNNTTTTSSSS
  19.       typedef ... pixel;
  20.       typedef ... pixval;
  21.       #define PPM_MAXMAXVAL    ...
  22.       extern pixval    ppm_pbmmaxval;
  23.  
  24.       Each ppppiiiixxxxeeeellll contains three ppppiiiixxxxvvvvaaaalllls, each of which should
  25.       contain only the values between 0000 and    PPPPPPPPMMMM____MMMMAAAAXXXXMMMMAAAAXXXXVVVVAAAALLLL.
  26.       ppppppppmmmm____ppppbbbbmmmmmmmmaaaaxxxxvvvvaaaallll    is the maxval used when    a PPM program reads a
  27.       PBM file.  Normally it is 1; however,    for some programs, a
  28.       larger value gives better results.
  29.  
  30.       #define PPM_FORMAT ...
  31.       #define RPPM_FORMAT ...
  32.       #define PPM_TYPE PPM_FORMAT
  33.       int PPM_FORMAT_TYPE( int format )
  34.  
  35.       For distinguishing different file formats and    types.
  36.  
  37.       pixval PPM_GETR( pixel p )
  38.       pixval PPM_GETG( pixel p )
  39.       pixval PPM_GETB( pixel p )
  40.  
  41.       These    three macros retrieve the red, green or    blue value
  42.       from the given pixel.
  43.  
  44.       void PPM_ASSIGN( pixel p, pixval red,    pixval grn, pixval blu )
  45.  
  46.       This macro assigns the given red, green and blue values to
  47.       the pixel.
  48.  
  49.       int PPM_EQUAL( pixel p, pixel    q )
  50.  
  51.       This macro checks two    pixels for equality.
  52.  
  53.       void PPM_DEPTH( pixel    newp, pixel p, pixval oldmaxval, pixval    newmaxval )
  54.  
  55.       This macro scales the    colors of pixel    pppp according the    old
  56.       and new maximum values and assigns the new values to nnnneeeewwwwpppp.
  57.       It is    intended to make writing ppmtowhatever easier.
  58.  
  59.       float    PPM_LUMIN( pixel p )
  60.  
  61.  
  62.  
  63.  
  64.      Page 1                         (printed 8/31/98)
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.      lllliiiibbbbppppppppmmmm((((3333))))               UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV             lllliiiibbbbppppppppmmmm((((3333))))
  72.  
  73.  
  74.  
  75.       This macro determines    the luminance of the pixel pppp.
  76.  
  77.     MMMMEEEEMMMMOOOORRRRYYYY MMMMAAAANNNNAAAAGGGGEEEEMMMMEEEENNNNTTTT
  78.       pixel** ppm_allocarray( int cols, int    rows )
  79.  
  80.       Allocate an array of pixels.
  81.  
  82.       pixel* ppm_allocrow( int cols    )
  83.  
  84.       Allocate a row of the    given number of    pixels.
  85.  
  86.       void ppm_freearray( pixel** pixels, int rows )
  87.  
  88.       Free the array allocated with    ppppppppmmmm____aaaallllllllooooccccaaaarrrrrrrraaaayyyy(((()))) containing
  89.       the given number of rows.
  90.  
  91.       void pbm_freerow( pixel* pixelrow )
  92.  
  93.       Free a row of    pixels.
  94.  
  95.     RRRREEEEAAAADDDDIIIINNNNGGGG    PPPPBBBBMMMM FFFFIIIILLLLEEEESSSS
  96.       void ppm_readppminit(    FILE* fp, int* colsP, int* rowsP, pixval* maxvalP, int*    formatP    )
  97.  
  98.       Read the header from a PPM file, filling in the rows,    cols,
  99.       maxval and format variables.
  100.  
  101.       void ppm_readppmrow( FILE* fp, pixel*    pixelrow, int cols, pixval maxval, int format )
  102.  
  103.       Read a row of    pixels into the    pixelrow array.     Format, cols,
  104.       and maxval were filled in by ppppppppmmmm____rrrreeeeaaaaddddppppppppmmmmiiiinnnniiiitttt(((()))).
  105.  
  106.       pixel** ppm_readppm( FILE* fp, int* colsP, int* rowsP, pixval* maxvalP )
  107.  
  108.       Read an entire pixmap    file into memory, returning the
  109.       allocated array and filling in the rows, cols    and maxval
  110.       variables.  This function combines ppppppppmmmm____rrrreeeeaaaaddddppppppppmmmmiiiinnnniiiitttt(((()))),
  111.       ppppppppmmmm____aaaallllllllooooccccaaaarrrrrrrraaaayyyy(((()))) and ppppppppmmmm____rrrreeeeaaaaddddppppppppmmmmrrrroooowwww(((()))).
  112.  
  113.     WWWWRRRRIIIITTTTIIIINNNNGGGG    FFFFIIIILLLLEEEESSSS
  114.       void ppm_writeppminit( FILE* fp, int cols, int rows, pixval maxval, int forceplain )
  115.  
  116.       Write    the header for a portable pixmap file.    The forceplain
  117.       flag forces a    plain-format file to be    written, as opposed to
  118.       a raw-format one.
  119.  
  120.       void ppm_writeppmrow(    FILE* fp, pixel* pixelrow, int cols, pixval maxval, int    forceplain )
  121.  
  122.       Write    a row from a portable pixmap.
  123.  
  124.       void ppm_writeppm( FILE* fp, pixel** pixels, int cols, int rows, pixval maxval, int forceplain )
  125.  
  126.       Write    the header and all data    for a portable pixmap.    This
  127.  
  128.  
  129.  
  130.      Page 2                         (printed 8/31/98)
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.      lllliiiibbbbppppppppmmmm((((3333))))               UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV             lllliiiibbbbppppppppmmmm((((3333))))
  138.  
  139.  
  140.  
  141.       function combines ppppppppmmmm____wwwwrrrriiiitttteeeeppppppppmmmmiiiinnnniiiitttt(((()))) and ppppppppmmmm____wwwwrrrriiiitttteeeeppppppppmmmmrrrroooowwww(((()))).
  142.  
  143.     CCCCOOOOLLLLOOOORRRR NNNNAAAAMMMMEEEESSSS
  144.       pixel    ppm_parsecolor(    char* colorname, pixval    maxval )
  145.  
  146.       Parses an ASCII color    name into a pixel.  The    color can be
  147.       specified in three ways.  One, as a name, assuming that a
  148.       pointer to an    X11-style color    names file was compiled    in.
  149.       Two, as an X11-style hexadecimal number: #rgb, #rrggbb,
  150.       #rrrgggbbb, or #rrrrggggbbbb.     Three,    as a triplet of
  151.       decimal floating point numbers separated by commas:
  152.       r.r,g.g,b.b.
  153.  
  154.       char*    ppm_colorname( pixel* colorP, pixval maxval, int hexok )
  155.  
  156.       Returns a pointer to a string    describing the given color.
  157.       If the X11 color names file is available and the color
  158.       appears in it, that name is returned.     Otherwise, if the
  159.       hexok    flag is    true then a hexadecimal    colorspec is returned;
  160.       if hexok is false and    the X11    color names file is available,
  161.       then the closest matching color is returned; otherwise, it's
  162.       an error.
  163.  
  164.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  165.       pbm(3), pgm(3)
  166.  
  167.      AAAAUUUUTTTTHHHHOOOORRRR
  168.       Copyright (C)    1989, 1991 by Tony Hansen and Jef Poskanzer.
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.      Page 3                         (printed 8/31/98)
  197.  
  198.  
  199.  
  200.